<template>
  <div></div>
</template>

<script>
import router from "@/router";
import { asyncRoutes } from "@/router";
import config from "@/config";
import { filterAsyncRoutes } from "@/store/modules/permission.js";

export default {
  name: "Page404",
  computed: {
    message() {}
  },
  data() {
    return {
      twoPhaseYwRouter: []
    };
  },
  created() {
    let thisRouter = localStorage.getItem("router");
    this.twoPhaseYwRouter = filterAsyncRoutes(
      asyncRoutes,
      config[localStorage.getItem("menusName")][thisRouter]
    );
    var nameData = this.twoPhaseYwRouter[
      this.twoPhaseYwRouter.length -
        (thisRouter ==
          "EARLY_MAPPING_RESULT_SECOND_AUDIT_FIRST_OPINION" ||
        thisRouter ==
          "EARLY_MAPPING_RESULT_SECOND_AUDIT_SECOND_OPINION" ||
        thisRouter ==
          "COMPLETING_RESULT_FIRST_AUDIT_FIRST_OPINION" ||
        thisRouter ==
          "COMPLETING_RESULT_FIRST_AUDIT_SECOND_OPINION"
          ? 3
          : 2)
    ];

    var src = "";
    if (nameData.children) {
      nameData.children.forEach(item => {
        if (item.children) {
          item.children.forEach(item1 => {
            if (item1.name == thisRouter) {
              src = item1.path;
              this.$router.push({ path: src });
            }
          });
        }
      });
    }
  }
};
</script>
